package com.ruoyi.dgw.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.dgw.domain.CowEssenMqtt;
import com.ruoyi.dgw.domain.CowShed;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.dgw.mapper.CowEssenMapper;
import com.ruoyi.dgw.domain.CowEssen;
import com.ruoyi.dgw.service.ICowEssenService;
import javax.annotation.Resource;

/**
 * 牛信息Service业务层处理
 *
 * @author ruoyi
 * @date 2021-12-01
 */
@Service
@Slf4j
public class CowEssenServiceImpl implements ICowEssenService
{
    @Resource
    private CowEssenMapper cowEssenMapper;

    /**
     * 查询牛信息
     *
     * @param cowEssenId 牛信息主键
     * @return 牛信息
     */
    @Override
    public CowEssen selectCowEssenByCowEssenId(String cowEssenId)
    {
        return cowEssenMapper.selectCowEssenByCowEssenId(cowEssenId);
    }

    /**
     * 查询牛信息列表
     *
     * @param cowEssen 牛信息
     * @return 牛信息
     */
    @Override
    public List<CowEssen> selectCowEssenList(CowEssen cowEssen)
    {
        return cowEssenMapper.selectCowEssenList(cowEssen);
    }

    /**
     * 新增牛信息
     *
     * @param cowEssen 牛信息
     * @return 结果
     */
    @Override
    public int insertCowEssen(CowEssen cowEssen)
    {
        cowEssen.setCreateTime(DateUtils.getNowDate());
        return cowEssenMapper.insertCowEssen(cowEssen);
    }

    /**
     * 修改牛信息
     *
     * @param cowEssen 牛信息
     * @return 结果
     */
    @Override
    public int updateCowEssen(CowEssen cowEssen)
    {
        return cowEssenMapper.updateCowEssen(cowEssen);
    }

    /**
     * 批量删除牛信息
     *
     * @param cowEssenIds 需要删除的牛信息主键
     * @return 结果
     */
    @Override
    public int deleteCowEssenByCowEssenIds(String[] cowEssenIds)
    {
        return cowEssenMapper.deleteCowEssenByCowEssenIds(cowEssenIds);
    }

    /**
     * 删除牛信息信息
     *
     * @param cowEssenId 牛信息主键
     * @return 结果
     */
    @Override
    public int deleteCowEssenByCowEssenId(String cowEssenId)
    {
        return cowEssenMapper.deleteCowEssenByCowEssenId(cowEssenId);
    }

    @Override
    public void insertBatch(CowEssenMqtt cowEssenMqtt) {
         cowEssenMapper.insertBatch(cowEssenMqtt);
    }
    public Map<String,Long>queryCountCow(){
        return cowEssenMapper.queryCountCow();
    }
    @Override
    public List<Map<String, String>> queryUser(String nickName, String deptName) {
        return cowEssenMapper.queryUser(nickName, deptName);
    }


}
